<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('员工管理列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>员工名称：</label>
                                <input type="text" name="employeeName"/>
                            </li>
                            <li>
                                <label>员工性别：</label>
                                <select name="sex" th:with="type=${@dict.getType('sys_user_sex')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>出生日期：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginBirthday]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endBirthday]"/>
                            </li>
                            <li>
                                <label>身份证号：</label>
                                <input type="text" name="idCard"/>
                            </li>
                            <li>
                                <label>婚姻状况：</label>
                                <select name="maritalStatus" th:with="type=${@dict.getType('hr_marital_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>邮箱：</label>
                                <input type="text" name="email"/>
                            </li>
                            <li>
                                <label>手机号：</label>
                                <input type="text" name="phoneNumber"/>
                            </li>
                            <li>
                                <label>部门id：</label>
                                <select name="deptId">
                                    <option value="">所有</option>
                                    <option value="-1">代码生成请选择字典属性</option>
                                </select>
                            </li>
                            <li>
                                <label>职称：</label>
                                <select name="jobLevel" th:with="type=${@dict.getType('hr_job_level')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>职位id：</label>
                                <select name="postId">
                                    <option value="">所有</option>
                                    <option value="-1">代码生成请选择字典属性</option>
                                </select>
                            </li>
                            <li>
                                <label>聘用形式：</label>
                                <select name="engageForm" th:with="type=${@dict.getType('hr_engage_form')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>最高学历：</label>
                                <select name="tiptopDegree" th:with="type=${@dict.getType('hr_tiptop_degree')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>入职日期：</label>
                                <input type="text" class="time-input" placeholder="请选择入职日期" name="beginDate"/>
                            </li>
                            <li>
                                <label>状态：</label>
                                <select name="status" th:with="type=${@dict.getType('hr_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>工号：</label>
                                <input type="text" name="workCode"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="hr:employee:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="hr:employee:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="hr:employee:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="hr:employee:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('hr:employee:edit')}]];
        var removeFlag = [[${@permission.hasPermi('hr:employee:remove')}]];
        var sexDatas = [[${@dict.getType('sys_user_sex')}]];
        var maritalStatusDatas = [[${@dict.getType('hr_marital_status')}]];
        var nationDatas = [[${@dict.getType('hr_nation_list')}]];
        var politicsStatusDatas = [[${@dict.getType('hr_politics_status')}]];
        var jobLevelDatas = [[${@dict.getType('hr_job_level')}]];
        var engageFormDatas = [[${@dict.getType('hr_engage_form')}]];
        var tiptopDegreeDatas = [[${@dict.getType('hr_tiptop_degree')}]];
        var statusDatas = [[${@dict.getType('hr_status')}]];
        var prefix = ctx + "hr/employee";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "员工管理",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'employeeId',
                    title: '员工id',
                    visible: false
                },
                {
                    field: 'employeeName',
                    title: '员工名称'
                },
                {
                    field: 'sex',
                    title: '员工性别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(sexDatas, value);
                    }
                },
                {
                    field: 'birthday',
                    title: '出生日期'
                },
                {
                    field: 'nation',
                    title: '民族',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(nationDatas, value);
                    }
                },
                {
                    field: 'email',
                    title: '邮箱'
                },
                {
                    field: 'phoneNumber',
                    title: '手机号'
                },
                {
                    field: 'jobLevel',
                    title: '职称',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(jobLevelDatas, value);
                    }
                },
                {
                    field: 'engageForm',
                    title: '聘用形式',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(engageFormDatas, value);
                    }
                },
                {
                    field: 'beginDate',
                    title: '入职日期'
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(statusDatas, value);
                    }
                },
                {
                    field: 'workCode',
                    title: '工号'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.employeeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.employeeId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>